package jumpingnotes.model.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "group_member", catalog = "jumping_notes")
public class GroupMember implements java.io.Serializable
{

	private Integer groupMemberId;
	private Group group;
	private Member member;
	private Integer memberIdInvite;
	private Date createTime;

	public GroupMember()
	{
	}

	public GroupMember(Group group, Member member)
	{
		this.group = group;
		this.member = member;
	}

	public GroupMember(Group group, Member member, Integer memberIdInvite, Date createTime)
	{
		this.group = group;
		this.member = member;
		this.memberIdInvite = memberIdInvite;
		this.createTime = createTime;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "group_member_id", unique = true, nullable = false)
	public Integer getGroupMemberId()
	{
		return this.groupMemberId;
	}

	public void setGroupMemberId(Integer groupMemberId)
	{
		this.groupMemberId = groupMemberId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "group_id", nullable = false)
	public Group getGroup()
	{
		return this.group;
	}

	public void setGroup(Group group)
	{
		this.group = group;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "member_id", nullable = false)
	public Member getMember()
	{
		return this.member;
	}

	public void setMember(Member member)
	{
		this.member = member;
	}

	@Column(name = "member_id_invite")
	public Integer getMemberIdInvite()
	{
		return this.memberIdInvite;
	}

	public void setMemberIdInvite(Integer memberIdInvite)
	{
		this.memberIdInvite = memberIdInvite;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", length = 19)
	public Date getCreateTime()
	{
		return this.createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

}
